<template>
  <base-breadcrumb :breadcrumb="!isAudit">
    <a-card>
      <title-name title="项目信息" />
      <a-form-model
        ref="form1"
        layout="horizontal"
      >
        <a-row :gutter="24">
                    <a-col
                      :md="16"
                      :sm="16"
                    >
                      <a-form-model-item
                        label="所属单位"
                        :label-col="{lg: {span: 7}, sm: {span:7}}"
                        :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
                      >
                     <org-tree-select disabled :value="dels.projectId"></org-tree-select>
                      </a-form-model-item>
                    </a-col>
<!--          <a-col-->
<!--            :md="8"-->
<!--            :sm="8"-->
<!--          >-->
<!--            <a-form-model-item-->
<!--              label="分公司"-->
<!--              :label-col="{lg: {span: 7}, sm: {span:7}}"-->
<!--              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"-->
<!--            >-->
<!--              <BaseInput-->
<!--                v-model="dels.branchCompanyName"-->
<!--                placeholder=""-->
<!--                disabled-->
<!--              />-->
<!--            </a-form-model-item>-->
<!--          </a-col>-->
<!--          <a-col-->
<!--            :md="8"-->
<!--            :sm="8"-->
<!--          >-->
<!--            <a-form-model-item-->
<!--              label="项目名称"-->
<!--              :label-col="{lg: {span: 7}, sm: {span:7}}"-->
<!--              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"-->
<!--            >-->
<!--              <BaseInput-->
<!--                v-model="dels.projectName"-->
<!--                placeholder=""-->
<!--                disabled-->
<!--              />-->
<!--            </a-form-model-item>-->
<!--          </a-col>-->
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="项目编号"
              :label-col="{lg: {span: 7}, sm: {span:7}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.projectNum"
                placeholder=""
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="项目经理"
              :label-col="{lg: {span: 7}, sm: {span:7}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.projectManager"
                placeholder=""
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="扣分前剩余分数"
              :label-col="{lg: {span: 7}, sm: {span:7}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
            <a-input-number disabled :min="0" :max="9999999999999" :step="1" v-model="dels.remainingPointsBeforeDeduction" :precision="2" />
              <!-- <BaseInput
                v-model="dels.remainingPointsBeforeDeduction"
                disabled
              /> -->
            </a-form-model-item>
          </a-col>
        </a-row>

        <title-name title="扣分信息" />
        <a-row :gutter="24">
          <a-col
            :md="24"
            :sm="24"
          >
            <a-form-model-item
              label="处罚认定"
              :label-col="{lg: {span: 2}, sm: {span:2}}"
              :wrapper-col="{lg: {span: 22}, sm: {span: 22} }"
            >
              <BaseInput
                v-model="dels.pointDeductionReason"
                type="textarea"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="24"
            :sm="24"
          >
            <a-form-model-item
              label="风险底线事件"
              :label-col="{lg: {span: 3}, sm: {span:3}}"
              :wrapper-col="{lg: {span: 21}, sm: {span: 21} }"
            >
              <BaseInput
                v-model="dels.remark	"
                placeholder=""
                type="textarea"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="扣分分数"
              :label-col="{lg: {span: 7}, sm: {span:7}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
             <a-input-number disabled :min="0" :max="9999999999999" :step="1" v-model="dels.pointsScore" :precision="2" />
              <!-- <BaseInput
                v-model="dels.pointsScore"
                placeholder=""
                disabled
              /> -->
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="创建人"
              :label-col="{lg: {span: 7}, sm: {span:7}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.creatorName"
                placeholder=""
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="创建时间"
              :label-col="{lg: {span: 7}, sm: {span:7}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.createTime"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>

      <title-name title="证明资料上传" />
      <a-table
        row-key="id"
        bordered
        :columns="columnAssment"
        :data-source="dels.fileInfoIds"
      >
        <span
          slot="serial"
          slot-scope="text, record, index"
        >{{ index + 1 }}</span><span
          slot="action"
          slot-scope="text, record, index"
        >
          <a
            :href="'/api/ycloud-file-center/oper/download?access_token='+token+'&fileId='+record.fileId"
            target="_parent"
          >导出</a>
          <a-divider
            type="vertical"
          />
          <a
            href="javascript:"
            @click="$filePreview(record)"
          >预览</a>
        </span>
      </a-table>
    </a-card>

    <div v-if="!isConsultation" class="tool-btns page-btn-right-top">
      <a-button
        type="primary"
        @click="goBack"
      >
        关闭
      </a-button>
    </div>
  </base-breadcrumb>
</template>

<script>
  import Vue from 'vue'
  import { STable, Ellipsis } from '@/components'
  import { getPointsRecordDetails } from '@/api/project/pointsRecord'
  import SelectSubCompany from '@/components/Select/SelectSubCompany' // 分公司
  import SelectProject from '@/components/Select/SelectProject' // 项目
  import ARow from 'ant-design-vue/es/grid/Row'

  const columnAssment = [
    {
      title: '序号',
       width: 65,
      dataIndex: 'serial',

      scopedSlots: { customRender: 'serial' },
    },
    {
      title: '附件名称',
      dataIndex: 'fileName',
    },
    {
      title: '附件格式',
      dataIndex: 'suffixName',
      width: '25%',
    },
    {
      title: '操作',
      key: 'action',
      width: '20%',
      scopedSlots: { customRender: 'action' },
    },
  ];
  export default {
    name:'a'+Date.now(),
    components: {
      ARow,
    },
    props: {
      // 是否作为审批详情
      isAudit: {
        type: Boolean,
        default: false
      },
      // 是否作为意见征询
      isConsultation: {
        type: Boolean,
        default: false
      }
    },
    data() {
      return {
        columnAssment, // 附件信息
        token:'',
        dels:{},  //

        id:'',
        type:''
      }
    },

    created() {
        this.id = this.$route.query.id
        this.type = this.$route.query.type
        this.token = Vue.getAcloudProvider().getAccessToken()
        this.getPointsRecordDetailsReq()
    },
    computed: {

    },
    methods: {

      // 关闭
      goBack(){
        if(this.type == 'approve'){
          window.close()
        }else{
          this.$multiTab.close(this.$route.fullpath)
        }


      },

      // 详情
      getPointsRecordDetailsReq(){
        getPointsRecordDetails({id:this.id}).then(res=>{
          this.dels = res.data
        })
      },

    }
  }
</script>
